blob: 11e6d45ccbccda399a1e6b454528fcb183589a2b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import { get } from "$lib/utils";
import { error } from "@sveltejs/kit";
export let load = async ({ cookies, depends, params: { username } }) => {
depends("app:user");
try {
let subject = await get(`/users/${username}`);
let expires = new Date();
expires.setSeconds(expires.getSeconds() + 380 * 24 * 60 * 60);
cookies.set("username", username, { path: "/", expires });
return { subject };
} catch (e) {
error(500, "Unable to retrieve user account data");
}
};
|